package LogServer.constants

import LogServer.utils.PropertiesUtil

/**
  * Created by root on 17-2-14.
  */

// 私有构造方法
class PropertiesAssemblyJar private() {

}

// 伴生对象，与类共享名字，可以访问类的私有属性和方法
object PropertiesAssemblyJar{
  /**
    * 获得依赖jar包父文件夹
    * @return
    */
  private def getBaseDir(): String = {
    val propertiesUtil = new PropertiesUtil()
    val resource = propertiesUtil.loadResources("assemblyJar.properties")
    val baseDir = propertiesUtil.getString("baseDir",resource)
    baseDir
  }

  /**
    *  copy these jars to the baseDir, here is the jars location in local maven path
    *  /root/.m2/repository/org/apache/spark/spark-streaming-kafka_2.10/1.4.1/spark-streaming-kafka_2.10-1.4.1.jar
    *  /root/.m2/repository/org/apache/kafka/kafka_2.10/0.8.2.1/kafka_2.10-0.8.2.1.jar
    *  /root/.m2/repository/com/101tec/zkclient/0.3/zkclient-0.3.jar
    *  /root/.m2/repository/com/yammer/metrics/metrics-core/2.2.0/metrics-core-2.2.0.jar
    *  /root/.m2/repository/org/apache/kafka/kafka-clients/0.8.2.1/kafka-clients-0.8.2.1.jar
    *  /root/.m2/repository/org/scalaj/scalaj-http_2.10/2.3.0/scalaj-http_2.10-2.3.0.jar
    * @return jar List
    */
  def getAssemblyJars(): List[String] ={
    val baseDir = getBaseDir()
    List(baseDir+"spark-streaming-kafka_2.10-1.4.1.jar",
      baseDir+"kafka_2.10-0.8.2.1.jar",
      baseDir+"zkclient-0.3.jar",
      baseDir+"metrics-core-2.2.0.jar",
      baseDir+"kafka-clients-0.8.2.1.jar",
      baseDir+"spark-mongodb_2.10-0.9.2.jar",
      baseDir+"scalaj-http_2.10-2.3.0.jar",
      baseDir+"LogServer.jar")
  }
}